#include "clog.h"
#include <string.h>
#include <iostream>

using namespace std;

namespace clog{

	int level = 3;
	const char *strs[] = {"","DEBUG","TRACE","INFO ","WARN ","ERROR","FATAL" };
	const char *timeFormat="%x %X";
	bool StartOfLine = true;
	char timBuf[1024];

	void getTime(){
		time_t timep;
		time(&timep);
		tm* t = localtime(&timep);
		int len = strftime(timBuf, sizeof(timBuf), timeFormat, t);
		timBuf[len] = 0;
	}

	void lineend(){
		if(!StartOfLine){
			printf("\n");
			StartOfLine = true;
		}
	}
	
	void setLevel(int l){
		level = l;
	}

}
